package com.cosina.game.robodefence.ui;

import com.cosina.game.robodefence.dao.EnemyDao;
import com.cosina.game.robodefence.data.EnemyData;
import com.cosina.game.robodefence.util.Time;
import com.cosina.game.robodefence.util.UpCount;

public class MotionManager implements Time {
	private static UpCount[] counts = new UpCount[EnemyData.KIND_COUNT];
	private static UpCount updateCount = new UpCount(2);
	static {
		for(int kind=0; kind<EnemyData.KIND_COUNT; kind++){
			counts[kind] = new UpCount(EnemyDao.getMotionCount(kind));
		}
	}

	@Override
	public void withTimeGo() {
		if(updateCount.upToAlram()){
			for(int i=0; i<EnemyData.KIND_COUNT; i++){
				counts[i].upToAlram();
			}
		}
	}
	
	public static int getFrame(int kind){
		return counts[kind].value;
	}
	
}
